home *** CD-ROM | disk | FTP | other *** search
/ HyperLib 1997 Winter - Disc 1 / HYPERLIB-1997-Winter-CD1.ISO.7z / HYPERLIB-1997-Winter-CD1.ISO / オンラインウェア / UTIL / DocAssembler 1.0 folder.sit / DocAssembler 1.0 folder / DocAssembler 1.0 / DA sample script < prev    next >
Text File  |  1996-02-17  |  5KB  |  109 lines

  1. (*
  2.  
  3. Sample script to show the DocAssembler's scripting features
  4. Before using this sample script, you need:
  5.  
  6. - AppleScript software installed
  7. - XTND software installed
  8. - the DocAssembler application installed
  9. - the "Examples" folder from the DocAssembler package in the same folder as DocAssembler
  10.  
  11. This example shows a Microsoft Word -> Microsoft RTF translation.
  12. If the required translators are not available, you will have to change the script.
  13.  
  14. *)
  15.  
  16. tell application "DocAssembler 1.0"
  17.     activate
  18.     try
  19.         with timeout of 600 seconds
  20.             
  21.             -- activate DocAssembler, create a new untitled document and remember it
  22.             
  23.             activate
  24.             set theDoc to (make new document)
  25.             
  26.             -- append some files along with their hierarchical level
  27.             -- Level 0 is the top (section) level
  28.             -- Level -1  is the second (sub-section) level
  29.             -- Level -2 is the third (chapter) level
  30.             -- Level -3 is the bottom (paragraph) level
  31.             
  32.             tell theDoc to add the file ":Examples:Sample file #1" with level 0
  33.             tell theDoc to add the file ":Examples:Sample file #2" with level -1
  34.             tell theDoc to add the file ":Examples:Sample file #3" with level -1
  35.             tell theDoc to add the file ":Examples:Sample file #4" with level -2
  36.             tell theDoc to add the file ":Examples:Sample file #5" with level -3
  37.             
  38.             -- assign the general preferences
  39.             
  40.             tell theDoc to set preference units to inches
  41.             tell theDoc to set preference left margin to 1.5
  42.             tell theDoc to set preference right margin to 1.5
  43.             tell theDoc to set preference top margin to 2.0
  44.             tell theDoc to set preference bottom margin to 2.0
  45.             tell theDoc to set preference with double sided
  46.             tell theDoc to set preference with include indexes
  47.             tell theDoc to set preference starting page to 3
  48.             
  49.             -- assign the left header preferences
  50.             
  51.             tell theDoc to set output option left header with include
  52.             tell theDoc to set output option left header font to "Courier"
  53.             tell theDoc to set output option left header size to 14
  54.             tell theDoc to set output option left header style to plain -- this is needed to override existing preferences
  55.             tell theDoc to set output option left header style to underline
  56.             tell theDoc to set output option left header justification to center
  57.             tell theDoc to set output option left header color to blue
  58.             tell theDoc to set output option left header text to "This is a Courier 14, underlined, centered, blue left header"
  59.             
  60.             -- assign the right header preferences
  61.             
  62.             tell theDoc to set output option right header with include
  63.             tell theDoc to set output option right header font to "Geneva"
  64.             tell theDoc to set output option right header size to 12
  65.             tell theDoc to set output option right header style to plain -- this is needed to override existing preferences
  66.             tell theDoc to set output option right header style to bold
  67.             tell theDoc to set output option right header justification to right
  68.             tell theDoc to set output option right header color to red
  69.             tell theDoc to set output option right header text to "This is a Geneva 12, bolded, right justified, red right header"
  70.             
  71.             -- assign the left footer preferences
  72.             
  73.             tell theDoc to set output option left footer with include
  74.             tell theDoc to set output option left footer font to "Helvetica"
  75.             tell theDoc to set output option left footer size to 12
  76.             tell theDoc to set output option left footer style to plain -- this is needed to override existing preferences
  77.             tell theDoc to set output option left footer style to italic
  78.             tell theDoc to set output option left footer justification to left
  79.             tell theDoc to set output option left footer color to green
  80.             tell theDoc to set output option left footer text to "This is a Helvetica 12, italicized, left justified, green left footer"
  81.             
  82.             -- assign the right footer preferences
  83.             
  84.             tell theDoc to set output option right footer with include
  85.             tell theDoc to set output option right footer font to "Monaco"
  86.             tell theDoc to set output option right footer size to 12
  87.             tell theDoc to set output option right footer style to plain -- this is needed to override existing preferences
  88.             tell theDoc to set output option right footer style to outline
  89.             tell theDoc to set output option right footer justification to full
  90.             tell theDoc to set output option right footer color to cyan
  91.             tell theDoc to set output option right footer text to "This is a Monaco 12, outlined, full justified, cyan right footer"
  92.             
  93.             -- produce an output file called "BuiltFromScript.rtf" asking to the RTF translator to make a RTF file
  94.             
  95.             tell theDoc to produce the file ":Examples:BuiltFromScript.rtf" using translator "RTF" with format "TEXT"
  96.             
  97.             -- save the DocAssembler document under the name "BuiltFromScript"
  98.             
  99.             save theDoc in file ":Examples:BuiltFromScript"
  100.         end timeout
  101.     on error errText number errNum
  102.         beep
  103.         display dialog "An error occurred! " & errText & " Error code: " & errNum buttons {"Alas"} default button "Alas" with icon 0
  104.         close theDoc saving no
  105.         quit
  106.         return
  107.     end try
  108.     quit
  109. end tell